﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

/// <summary>
/// Summary description for DataAccess
/// </summary>
public class DataAccess
{
    SqlConnection con;
    public DataAccess()
    {
        string conString = @"Data Source=DRGNS\SQLEXPRESS;Initial Catalog=CheckRegister;Integrated Security=True";
        con = new SqlConnection(conString);
    }

    public DataTable GetTransTypes()
    {
        DataTable results = new DataTable();

        FillDataTable(results, "select * from TransactionType", CommandType.Text);

        return results;
    }



    private void FillDataTable(DataTable table, string cmdText, CommandType cmdType)
    {
        SqlCommand cmd = new SqlCommand(cmdText, con);
        cmd.CommandType = cmdType;
        con.Open();

        SqlDataAdapter da = new SqlDataAdapter(cmd);

        da.Fill(table);

    }


}
